package controller;

import entity.Emp;
import service.EmpService;
import service.EmpServiceImpl;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "ShowAllEmpCtrl", value = "/Manager/safe/ShowAllEmpCtrl")
public class ShowAllEmpCtrl extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("登录成功！");
        EmpService empService = new EmpServiceImpl();
        List<Emp> empList = empService.showAll();
        request.setAttribute("empList",empList);
        for(Emp e:empList){
            System.out.println(e);
        }
        request.getRequestDispatcher("/ShowAllEmp.jsp").forward(request,response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
